//
//  SuperViewController.m
//  SSC
//
//  Created by 红沙尘 on 17/6/6.
//  Copyright © 2017年 红沙尘. All rights reserved.
//

#import "SuperViewController.h"
#import "LogViewController.h"
#import <AudioToolbox/AudioToolbox.h>

@interface SuperViewController ()

@end

@implementation SuperViewController

- (void)dealloc {
    NSLog(@"%@ dealloc",self);
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                                                  forBarMetrics:UIBarMetricsDefault];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *left = [self leftButtonWithImageNamed:@"public_back" action:@selector(back)];
    self.navigationItem.leftBarButtonItem = CUSTOMVIEW(left);

    [self setupUI];
    [self setupData];
}

- (void)back {
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - UITableViewDelegate,UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return [[UITableViewCell alloc] initWithStyle:0 reuseIdentifier:@"Cell"];
}

#pragma mark - public

- (UIButton *)leftButtonWithImageNamed:(NSString *)imageNamed action:(SEL)action {
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
    [btn setImage:LoadImage(imageNamed) forState:UIControlStateNormal];
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [btn addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
    return btn;
}

- (UIButton *)rightButtonWithImageNamed:(NSString *)imageNamed action:(SEL)action {
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
    [btn setImage:LoadImage(imageNamed) forState:UIControlStateNormal];
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    [btn addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
    return btn;
}



#pragma mark - private

#pragma mark 摇一摇
//- (BOOL)canBecomeFirstResponder {//默认是NO，所以得重写此方法，设成YES
//    return YES;
//}
//
//- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
//    NSLog(@"开始摇动");
////    return;
//}
//
//- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
//    NSLog(@"取消摇动");
////    return;
//}
//
//- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
//    NSLog(@"摇动结束");
//    if (event.subtype == UIEventSubtypeMotionShake) { // 判断是否是摇动结束
//        NSLog(@"摇动结束");
//        AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
//        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[LogViewController alloc] init]];
//        
//        [self presentViewController:nav animated:YES completion:nil];
//    }
//
//}

#pragma mark - loadData

- (void)setupData {
    
}

#pragma mark - setup

- (void)setupUI {
    
    
}

@end
